home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
bbsutil
/
hsrc_117.zip
/
CONFIG.C
< prev
next >
Wrap
Text File
|
1990-11-12
|
11KB
|
455 lines
/* XBBS Message Base Reader -- This module parses the control file */
#include "msgg.h"
#include "twindow.h"
#include "keys.h"
#include "headedit.h"
void pascal read_control (char *file,char *application) {
struct nodeidx huge *nidxx=NULL;
int pf;
static char s[256];
char *p;
char *pp;
struct ffblk f;
char nonodelist=0;
char nomouse=0;
long x;
for(x=0;x<10;x++) fkey[(word)x]=NULL;
if(!strchr(file,'\\') && !strchr(file,':') && !strchr(file,'/')) {
p=searchpath(file);
file=p;
}
if(!(pf=_open(file,O_RDONLY | O_DENYNONE | O_TEXT))==-1) {
error_message(" Can't open ctl file ");
pause();
exit(3);
}
fputs("\nParsing config file...",stderr);
if(*application && application) {
while (!eof(pf)) {
getone(s,pf);
if (!*s) continue;
p=strtok(s," ");
strupr(p);
pp=strtok(0,"\n");
if (pp==NULL) pp="";
strip(pp,98);
stripcr(p);
if(!stricmp(p,"APPLICATION")) {
if(!stricmp(pp,application)) break;
}
}
}
if(eof(pf)) {
error_message(" APPLICATION statement not matched or empty file ");
pause();
exit(3);
}
while (!eof(pf)) {
getone(s,pf);
if (!*s) continue;
p=strtok(s," ");
pp=strtok(0,"\n");
if (pp==NULL) pp="";
strip(pp,98);
stripcr(p);
#ifdef DEBUG
printf("\n`%s' -> `%s'",p,pp);
#endif
if(!stricmp(p,"SPAWNVIEW")) {
strip(pp,79);
if(spawnview) free(spawnview);
spawnview=strdup(pp);
}
else if(!stricmp(p,"FLSEARCH")) {
strip(pp,79);
if(flsearch)free(flsearch);
flsearch=strdup(pp);
}
else if(!stricmp(p,"ENDAPP")) break;
else if (!stricmp(p,"ADDRESS") && noaddress<(char)(max(maxy,25)-2)) {
strip(pp,27);
pp=strtok(pp,":");
address[noaddress]=(struct _address *)malloc(sizeof(struct _address));
if (address[noaddress]==NULL) {
fputs("\nOOM for addresses\n",stdout);
}
else {
address[noaddress]->zone=(word)atol(pp);
address[noaddress]->net=(word)atol(strtok(0,"/"));
address[noaddress]->node=(word)atol(strtok(0,"."));
address[noaddress]->point=(word)atol(strtok(0,"@"));
p=strtok(0,"\n");
strncpy(address[noaddress]->domain,p,37);
address[noaddress]->domain[36]=0;
noaddress++;
}
}
else if(!stricmp(p,"FKEY")) {
int temp;
temp=atoi(strtok(pp," "));
pp=strtok(0,"\n");
lstrip(pp);
if(pp!=NULL && *pp && temp>0 && temp<11) {
if(fkey[temp-1])free(fkey[temp-1]);
fkey[temp-1]=(char *)malloc(strlen(pp)+1);
if(!fkey[temp-1]) continue;
strcpy(fkey[temp-1],pp);
}
}
else if(!stricmp(p,"VMODE")) {
videomethod=atoi(pp);
}
else if(!stricmp(p,"HEIGHT")) {
maxy=atoi(pp);
}
else if(!stricmp(p,"WIDTH")) {
maxx=atoi(pp);
}
else if(!stricmp(p,"NOMOUSE")) {
nomouse=1;
}
if (!stricmp(p,"NOHILITE")) {
hilite=1;
}
else if (!stricmp(p,"TEMPLATE")) {
strip(pp,79);
if(template)free(template);
template=strdup(pp);
}
else if (!stricmp(p,"TEXTEDITOR")) {
if(texteditor) free(texteditor);
texteditor=strdup(pp);
}
else if (!stricmp(p,"USEDEFAULT")) {
usedefault=1;
}
else if (!stricmp(p,"MAKEINFO")) {
makeinfo=1;
}
else if (!stricmp(p,"NO*PT")) {
nopt=1;
}
else if (!stricmp(p,"NOINTL")) {
nointl=1;
}
else if (!stricmp(p,"NOCHECK")) {
autocheck=0;
}
else if (!stricmp(p,"COMPRESS")) {
packsize=(word)atol(pp);
if(packsize<1024)packsize=1024;
}
else if(!stricmp(p,"NOTRACK")) {
notrack=1;
}
else if(!stricmp(p,"NETBOARD")) {
netboard=(word)atol(pp);
if(netboard>4095)netboard=0;
}
else if(!stricmp(p,"ALTBOARD")) {
altboard=(word)atol(pp);
if(altboard>4095)altboard=0;
}
else if(!stricmp(p,"TOTALAREAS")) {
totalareas=(word)atol(pp);
printf("\nTracking LMRs for %u areas",totalareas);
}
else if(!stricmp(p,"USERNUMBER")) {
userno=(word)atol(pp);
}
else if (!stricmp(p,"START")) {
areano=(word)atol(pp);
if (areano<1 || areano>4095) areano=0;
}
else if (!stricmp(p,"WRAP")) {
if(wrapcall) free(wrapcall);
wrapcall=strdup(pp);
}
else if (!stricmp(p,"LINES")) {
maxlines=(word)atol(pp);
if (maxlines<257) maxlines=257;
}
else if (!stricmp(p,"BEFOREQUOTE")) {
strip(pp,79);
if(before_quote) free(before_quote);
before_quote=strdup(pp);
}
else if (!stricmp(p,"AFTERBEFORE")) {
strip(pp,79);
if(after_before) free(after_before);
after_before=strdup(pp);
}
else if (!stricmp(p,"AFTERQUOTE")) {
strip(pp,79);
if(after_quote) free(after_quote);
after_quote=strdup(pp);
}
else if (!stricmp(p,"NONODELIST")) {
nonodelist=1;
}
else if (!stricmp(p,"EDITOR")) {
if(editor)free(editor);
editor=strdup(pp);
}
else if (!stricmp(p,"ANSIEDITOR")) {
if(ansieditor)free(ansieditor);
ansieditor=strdup(pp);
}
else if (!stricmp(p,"NODELIST")) {
strip(pp,78);
if(nodepath)free(nodepath);
nodepath=strdup(pp);
}
else if (!stricmp(p,"PAGELENGTH")) {
pagelength=(char)atoi(pp);
}
else if (!stricmp(p,"TOPMARGIN")) {
topmargin=(char)atoi(pp);
}
else if (!stricmp(p,"BOTTOMMARGIN")) {
bottommargin=(char)atoi(pp);
}
else if (!stricmp(p,"LEFTMARGIN")) {
leftmargin=(char)atoi(pp);
}
else if (!stricmp(p,"TEXTWIDTH")) {
textwidth=(char)atoi(pp);
}
else if (!stricmp(p,"BEFOREHEADER")) {
strip(pp,11);
while ((p=strchr(pp,'~'))) *p='\x1b';
while ((p=strchr(pp,'`'))) *p='\n';
strcpy(beforeheader,pp);
}
else if (!stricmp(p,"AFTERTEXT")) {
strip(pp,47);
while ((p=strchr(pp,'~'))) *p='\x1b';
while ((p=strchr(pp,'`'))) *p='\n';
strcpy(aftertext,pp);
}
else if (!stricmp(p,"AFTERHEADER")) {
strip(pp,11);
while ((p=strchr(pp,'~'))) *p='\x1b';
while ((p=strchr(pp,'`'))) *p='\n';
strcpy(afterheader,pp);
}
else if (!stricmp(p,"AFTERPRINTING")) {
strip(pp,11);
while ((p=strchr(pp,'~'))) *p='\x1b';
while ((p=strchr(pp,'`'))) *p='\n';
strcpy(afterprinting,pp);
}
else if (!stricmp(p,"ALIAS") && noalias<(char)(max(maxy,25)-2)) {
strip(pp,35);
if(noalias) for(x=0;x<noalias;x++) {
if(!stricmp(pp,alias[(word)x])) goto BreakOut;
}
alias[noalias]=(char *)malloc(36);
if (alias[noalias]==NULL) {
fputs("\nOOM for aliases\n",stdout);
}
else {
strcpy(alias[noalias],pp);
noalias++;
}
BreakOut:
;
}
else if (!stricmp(p,"ATTRIBUTES")) defaultattr=(word)atol(pp);
else if (!stricmp(p,"EXPORTNAME")) {
strip(pp,65);
strcpy(filenamer,pp);
}
else if (!stricmp(p,"PATH") && nodirs<(char)(max(maxy,25)-2)) {
strip(pp,78);
if(nodirs) for(x=0;x<nodirs;x++) {
if(!stricmp(pp,dirs[(word)x])) goto BreakOut2;
}
dirs[nodirs]=(char *)malloc(79);
if(dirs[nodirs]==NULL) {
fputs("\nOOM for paths\n",stdout);
}
else {
if(!*pp) dirs[nodirs]=0;
strcpy(dirs[nodirs],pp);
nodirs++;
}
BreakOut2:
;
}
else if (!stricmp(p,"USEEMS")) {
LIMEMS=1;
}
else if (!stricmp(p,"SWAP")) {
swap=1;
}
else if (!stricmp(p,"SWAPDRIVE")) {
useswapdisk=toupper(*pp);
}
else if (!stricmp(p,"SWAPFILE")) {
strip(pp,63);
strcpy(swapname,pp);
}
if (!stricmp(p,"TEXTCOLOR")) readtextcolor=(char)atoi(pp);
else if (!stricmp(p,"TEXTBACK")) readtextback=(char)atoi(pp);
else if (!stricmp(p,"STATCOLOR")) readstatcolor=(char)atoi(pp);
else if (!stricmp(p,"STATBACK")) readstatback=(char)atoi(pp);
else if (!stricmp(p,"HEADCOLOR")) readheadcolor=(char)atoi(pp);
else if (!stricmp(p,"HEADBACK")) readheadback=(char)atoi(pp);
else if (!stricmp(p,"ORIGFORE")) orig_fore=(char)atoi(pp);
else if (!stricmp(p,"ORIGBACK")) orig_back=(char)atoi(pp);
else if (!stricmp(p,"TEARFORE")) tear_fore=(char)atoi(pp);
else if (!stricmp(p,"TEARBACK")) tear_back=(char)atoi(pp);
else if (!stricmp(p,"QUOTEFORE")) quote_fore=(char)atoi(pp);
else if (!stricmp(p,"QU